package com.ruoyi.netty.rabbitmq;

import com.ruoyi.common.redis.configure.FastJson2JsonRedisSerializer;
import com.ruoyi.common.redis.configure.RedisConfig;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.netty.client.NettyClientHandler;
import com.ruoyi.netty.pojo.VehicleData;
import com.ruoyi.netty.utils.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.GeoOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;

import java.time.LocalDateTime;

/**
 * @author Administrator
 * @version 1.0
 * @description: TODO
 * @date 2023/11/18 11:16
 */
public class VehicMapper {
    private static final Logger log = LoggerFactory.getLogger(VehicMapper.class);

    public void VehicleStart(String vin) {
        RedisTemplate redisTemplate = RedisUtil.redis;
        System.out.println(redisTemplate);
        HashOperations hash = redisTemplate.opsForHash();
        hash.put("VehicMapper:","Start"+vin,vin+LocalDateTime.now());
    }

    public void VehicleStop(String vin) {
        RedisTemplate redisTemplate = RedisUtil.redis;
        System.out.println(redisTemplate);
        HashOperations hash = redisTemplate.opsForHash();
        hash.put("VehicMapper:","Stop"+vin,vin+LocalDateTime.now());
    }

    public void VehicleMessage(VehicleData vin) {
        RedisTemplate redisTemplate = RedisUtil.redis;
        System.out.println(redisTemplate);
        HashOperations hash = redisTemplate.opsForHash();
        hash.put("VehicMapper:","Message"+vin.getVin(),vin);
    }


    public void VehicleClose(String vin) {
        RedisTemplate redis = RedisUtil.redis;
        HashOperations hash = redis.opsForHash();
        hash.put("VehicMapper:","Close",vin+ LocalDateTime.now());
    }

}
